package com.jt.Controller;

import com.jt.Service.UserService;
import com.jt.pojo.User;
import com.jt.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;
   @PostMapping("/login")
    public SysResult login(@RequestBody User user){
       String token=userService.login(user);
       if (StringUtils.hasLength(token)){
           return SysResult.success(token);
       }
       return SysResult.fail();

   }
}
